using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookInfoCS
{
    [ToolboxData("<{0}:TemplateControl runat=server></{0}:TemplateControl>")]
    public class TemplateControl : WebControl
    {
        private System.Web.UI.ITemplate TemplateHolder = null;
 
        protected override void CreateChildControls()
        {
         TemplateManager tm;

         if (TemplateHolder != null) 
         {
            tm = new TemplateManager();
            TemplateHolder.InstantiateIn(tm);
            this.Controls.Add(tm);

            tm = new TemplateManager();
            TemplateHolder.InstantiateIn(tm);
            this.Controls.Add(tm);
          }
        }

        [TemplateContainer(typeof(TemplateManager))]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public System.Web.UI.ITemplate TemplateManager
        {
       
           get
            {
                return TemplateHolder;
            }
            set
            {
                TemplateHolder = value;
            }
        }

    }
}
